#ifndef __THREADPOOL_H__
#define __THREADPOOL_H__
#include <server_conf.h>

//自定义数据处理函数
typedef int (*FUNC)(void *data);

//静态线程池结构体
typedef struct threadPool_st
{
	pthread_t tid[THREADNUM];
	unsigned int sumEpollDetectFdNum[THREADNUM];
	int epollfd[THREADNUM];
	pthread_mutex_t mutex;
	pthread_cond_t  cond;
	FUNC fun;
}T_threadPool,*PT_threadPool;

//数据处理函数参数结构体
typedef struct threadFun_st
{
	int pos;
	int clientfd;
	PT_threadPool threadPool;
}T_threadFun,*PT_threadFun;

PT_threadPool threadPool_init(FUNC fun);
int threadPool_addjob(PT_threadPool threadPool,int clientfd);
void threadPool_destroy(PT_threadPool threadPool);

//线程池实例
extern PT_threadPool g_pthreadPool;

#endif

